package cn.mogugo.comm;

import java.util.List;

public class PageSupport { 
	/**
	 * 记录结果集
	 */
	private List items;   
	/**
	 * 总记录数
	 */
    private int totalCount;
    /**
     * 当前页数
     */
    private int startIndex;
    /**
     * 每页的记录数
     */
    private int pageSize = CC.PAGE_SIZE;
  
    public PageSupport(List items, int totalCount, int pageSize, int startIndex) {
        setTotalCount(totalCount);
        setItems(items);   
        setStartIndex(startIndex);
        setPageSize(pageSize);
    }

    
    /**
     * 取总页数
     */
    public int getTotalPageCount() {
        if (totalCount % pageSize == 0)
            return totalCount / pageSize;
        else
            return totalCount / pageSize + 1;
    }
    
	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}   
    



}
